/**
 * 
 */
package com.kavitha.normal.web;

import java.io.IOException;
import java.net.URLEncoder;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * @author Vijayan Srinivasan
 * @since May 1, 2013 3:40:16 PM
 * 
 */
public class MyThirdServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;

	private Log log = LogFactory.getLog(getClass());

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doPost(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String exp= req.getParameter("exp");
		log.info("Expression exp=" + exp);
		resp.sendRedirect("https://www.google.com/search?q="+URLEncoder.encode(exp, "utf-8"));
	}

}